<?php
/**
 * Created by PhpStorm.
 * User: USER
 * Date: 2017/4/18
 * Time: 14:56
 */

namespace JsonRpc\Services;


use JsonRpc\Models\SysClient;

class Client
{
    use CommonService;

    private static function getBaseModel(){
        return "JsonRpc\\Models\\OrgService";
    }

    //帐套添加
    public function addClient($params)
    {
        $res = SysClient::insert($params);
        return $res;
    }

    //帐套查询
    public function getClientInfo($params)
    {
        $res = [];
        if (!empty($params)) {
            $res = SysClient::where('name',$params['name'])->get();
        }
        return $res;

    }

    //帐套更新
    public function updateClientInfo($params)
    {
        $res = [];
        if (!empty($params)) {
            $res = SysClient::where('id',$params['id'])->update([
                'company_name' => $params['company_name'],
                'company_logo' => $params['company_logo'],
                'company_address' => $params['company_address'],
                'company_phone' => $params['company_phone'],
                'company_bank' => $params['company_bank'],
                'bank_number' => $params['bank_number'],
                'user_prefix' => $params['user_prefix']
            ]);
        }
        return $res;

    }
}